/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.seu.cose.hobbysharing.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Yan
 */
public class ConnectionFactory {
     private static final String dbName="hobby_sharing_schema";
     public Connection getConnection (){  
        try{
            Class.forName("com.mysql.jdbc.Driver");
         //配置数据源
            String url="jdbc:mysql://localhost/"+ dbName +
                "?useUnicode=true&characterEncoding=UTF-8";
            System.out.print("it works");
            return DriverManager.getConnection(url,"root","root");
        } catch (Exception e){
            System.out.print("fuck off");
            return null;
       }
   }
}
